x86/cpu: fix build with clang 3.5
authorRoger Pau Monné <roger.pau@citrix.com>
Tue, 2 Jun 2020 11:38:32 +0000 (13:38 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 2 Jun 2020 11:38:32 +0000 (13:38 +0200)
commit51461114e2639596fce174fcdd2fab608883ab3e
treea08bd3aeaa84d19f3d9af3e3e514e51e12e8bc36
parent10d27b48b5b4dfbead2d9bf03290984bba4806e4
x86/cpu: fix build with clang 3.5

Clang 3.5 complains with:

common.c:794:24: error: statement expression not allowed at file scope
                      i < ARRAY_SIZE(this_cpu(tss_page).ist_ssp); ++i )
                                     ^
/build/xen/include/asm/percpu.h:14:7: note: expanded from macro 'this_cpu'
    (*RELOC_HIDE(&per_cpu__##var, get_cpu_info()->per_cpu_offset))
      ^
/build/xen/include/xen/compiler.h:104:3: note: expanded from macro 'RELOC_HIDE'
  ({ unsigned long __ptr;                       \
  ^
/build/xen/include/xen/lib.h:68:69: note: expanded from macro 'ARRAY_SIZE'
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]) + __must_be_array(x))
                                                                    ^
/build/xen/include/xen/compiler.h:85:57: note: expanded from macro '__must_be_array'
  BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0])))
                                                        ^
/build/xen/include/xen/lib.h:39:57: note: expanded from macro 'BUILD_BUG_ON_ZERO'
#define BUILD_BUG_ON_ZERO(cond) sizeof(struct { int:-!!(cond); })
                                                        ^

Workaround this by defining the tss_page as a local variable. Adjust
other users of the per-cpu tss_page to also use the newly introduced
local variable.

No functional change expected.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Wei Liu <wl@xen.org>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Release-acked-by: Paul Durrant <paul@xen.org>
xen/arch/x86/cpu/common.c